<?php 
$parent_url_segment = $this->get_data('parent_url_segment');
$base_url = $this->get_data('base_url');

$menu_items = $this->get_data('menu_items');
$selected_node_id = $this->get_data('selected_node_id');
$html_items = array();
$prev_item = false;
foreach ($menu_items as $item) {
    //$href = $parent_url_segment. '/' . $item['url_segment'];
    $href = $base_url ? $base_url . '/' . $item['url_segment'] : $item['url_segment'];
    $href = tos_url($href);
    $selected = ($selected_node_id == (int) $item['id']) ? ' class="current"' : '';
    $html_items[] = '<li><a href="' . $href . '"'. $selected . '>'. $item['caption'] . '</a></li>';
    //$prev_item = $item;
}
?>
<ul>
<?php echo implode('', $html_items);?>
</ul>